<template>
    <div class="pad">
        <!-- table start -->
        <tableDataEl
                :page.sync="page"
                :pageSuze.sync="pageSize"
                :tableData="tableData.list"
                :tableLabel="tableLabel"
                @handleDetail="handleDetail"
                :pageCount="tableData.rows"
                height="89vh"
                v-loading="loading"
        />
        <!-- table end -->
        <!-- el-dialog start -->
        <el-dialog
                :visible.sync="isShowDialog"
                center
                title="详情"
                width="30%"
                v-el-drag-dialog
        >
            <el-form
                    label-width="80px"
                    label-position="left"
            >
                <el-form-item label="省市区县:">
                    {{addressPar}}
                </el-form-item>
                <el-form-item label="详细地址:">
                    {{address}}
                </el-form-item>
            </el-form>
        </el-dialog>
        <!-- el-dialog end -->
    </div>
</template>

<script>
    import tableDataEl from '@/views/Setup/common/table'
    export default {
        name: "reject",
        components: {
            tableDataEl
        },
        data () {
            return {
                page: 1,
                pageSize: 8,
                tableData: {},
                tableLabel: [
                    {
                        label: '姓名',
                        prop: 'name'
                    },
                    {
                        label: '年龄',
                        prop: 'age'
                    },
                    {
                        label: '婚否',
                        prop: 'merriage',
                        merriage: true
                    },
                    {
                        label: '政治面貌',
                        prop: 'politics'
                    },
                    {
                        label: '职业',
                        prop: 'career'
                    },
                    {
                        label: '服役单位',
                        prop: 'arms'
                    },
                    {
                        label: '入伍时间',
                        prop: 'start_time'
                    },
                    {
                        label: '转业时间',
                        prop: 'end_time'
                    },
                    {
                        label: '地址',
                        detail: true,
                        btnText: '查看',
                        methodName: 'handleDetail'
                    },
                    {
                        label: '申请时间',
                        prop: 'create_time',
                        width:'500px'
                    },
                    {
                        label: '驳回时间',
                        prop: 'audit_time'
                    },
                    {
                        label: '驳回理由',
                        prop: 'reason'
                    },
                    {
                        label: '审核人',
                        prop: 'audit_person'
                    }
                ],
                loading: false,
                isShowDialog: false,
                addressPar: '',
                address: ''

            }
        },
        methods: {
            async init () {  //初始化
                this.loading = true;
                let res = await this.api.admin_t_rejectList({page: this.page, pageSize: this.pageSize});
                res.code ? this.tableData = res.data : this.$message(res.msg);
                this.loading = false;
            },
            async handleDetail (...value) {
                let temp = value[1];
                this.isShowDialog = true;
                this.addressPar = temp['province'] + temp['city'] + temp['county'];
                this.address = temp['address'];
            }
        },
        mounted () {
            this.init()
        },
        watch: {
            page () {
                this.init();
            },
            pageSize () {
                this.init();
            }
        }
    }
</script>

<style scoped>
    .el-form-item {
        margin-bottom:10px;
    }
</style>
